package com.zhoukx.builder.improve;

/**
 * @ClassName HouseDirector
 * @Description:
 * @Author zhoukx
 * @Date 2020/8/7
 **/
// 指挥者，动态的指定制作流程，返回产品
public class HouseDirector {
    HouseBuilder houseBuilder = null;

    //  通过构造器 传入 houseBuilder
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }


    // 通过setting方法传入
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //如果处理建造房子的流程，交给指挥者
    public House constructHouse(){
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return  houseBuilder.buildHouse();
    }
}
